#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
int main()
{
	pid_t pid = fork();
	if(pid < 0)
	{
		exit(1);
	}
	else if(pid == 0)
	{
		//chind process
		int cnt = 20;
		while(cnt--)
		{
		printf("子进程pid:%d\n",getpid());
		printf("父进程pid:%d\n\n",getppid());
		sleep(1);
		}
	}	
	else
	{
		//父进程
		sleep(10);
		exit(1);
	}
	return 0;
}
